package jp.tkym.labs.store;

import jp.tkym.labs.store.api.BeanIs;
import jp.tkym.labs.store.api.BeanQuery;
import jp.tkym.labs.store.api.BeanStore;

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.Key;

/**
 * GoogleBeanIs
 * 
 * @author takayama
 * @param <T>
 */
class GoogleBeanIs<T> implements BeanIs<T> {
	private DatastoreService ds;
	private Key parent;

	GoogleBeanIs(DatastoreService ds, Key parent) {
		this.ds = ds;
		this.parent = parent;
	}

	@Override
	public <C> BeanStore<C> store(Class<C> cls) {
		return new GoogleBeanStore<C>(ds, cls, parent);
	}

	@Override
	public <C> BeanQuery<C> query(Class<C> cls) {
		return new GoogleBeanQuery<C>(ds, cls, parent);
	}
}